package cmd

import (
	"app/deploy"
	"github.com/spf13/cobra"
)

var serverCmd = &cobra.Command{
	Use:   "server",
	Short: "启动服务器",
	Run: func(cmd *cobra.Command, args []string) {
		serverFunc(args)
	},
}

var initDbCmd = &cobra.Command{
	Use:   "init-db",
	Short: "初始化数据库",
	Run: func(cmd *cobra.Command, args []string) {
		deploy.InitDB()
	},
}

var testCmd = &cobra.Command{
	Use:   "test",
	Short: "单元测试",
	Run: func(cmd *cobra.Command, args []string) {

	},
}

var funcWrite2File = &cobra.Command{
	Use:   "write",
	Short: "写入文件",
	Run: func(cmd *cobra.Command, args []string) {
		WriteFile(args, "hello!\n")
	},
}

var funcExcel2go = &cobra.Command{
	Use:   "excel",
	Short: "解表",
	Run: func(cmd *cobra.Command, args []string) {
		excelDir := `../game_ufo/excel/`
		jsonDir := `../game_ufo/excelconfig/json/`
		goDir := `../game_ufo/excelconfig/`
		excelFunc(args, excelDir, jsonDir, goDir)
	},
}

var funcGenerateModel = &cobra.Command{
	Use:   "model",
	Short: "根据orm生成go代码",
	Run: func(cmd *cobra.Command, args []string) {
		ormFunc(args)
	},
}

var funcCmd = &cobra.Command{
	Use:   "func",
	Short: "调用方法",
	Run: func(cmd *cobra.Command, args []string) {
		test()
	},
}

// go install github.com/hajimehoshi/file2byteslice
var packCmd = &cobra.Command{
	Use:   "pack",
	Short: "打包文件",
	Run: func(cmd *cobra.Command, args []string) {
		resourcesDir := `../game_ufo/resources/`
		jsonDir := `../game_ufo/excelconfig/json/`
		staticDir := `../game_ufo/static/`
		packFunc(args, resourcesDir, jsonDir, staticDir)
	},
}
